#coding=cp936
import os
import shutil
import win32api


def getFileVersion(file_name):
    info = win32api.GetFileVersionInfo(file_name, os.sep)
    ms = info['FileVersionMS']
    ls = info['FileVersionLS']
    version = '%d.%d.%d.%d' % (win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls))
    return version


shutil.copy('NBYTINOKINSTALL.exe','UpxApp/NBYTINOKINSTALL.exe');
os.system('upx -9 UpxApp/NBYTINOKINSTALL.exe')


#os.system('rar a -df UpxApp/ZCGL UpxApp/ZCGL.exe');
#os.system('rar a UpxApp/ZCGL UpxApp/ZCGL.exe');
#rarcmd='rar a UpxApp/ZCGL_V%s.rar UpxApp/ZCGL.exe' % getFileVersion('UpxApp/ZCGL.exe')
#os.system(rarcmd)


